<template>
  <div class="myClass">
    <div>
      <div class="course" v-for="item in Course">
        <div class="courseID">课程ID:{{item.cid}}</div>
        <div class="courseName">课程名{{item.name}}:</div>
        <div class="time">任课教师:{{item.cid}}</div>
        <div class="time">课程所在地:{{item.loc}}</div>
        <div class="time">上课时间:{{item.week}}&nbsp;{{item.time}}</div>
      </div>
    </div>
  </div>
</template>

<script>
export default {
  methods:{
    action(){
      this.findMyClass()
    },
    findMyClass(){
      let _this=this
      this.$axios({
        method:"GET",
        url:"http://localhost/student/findByUsername/"+_this.username
      }).then(response => {
        _this.$axios({
          method:"GET",
          url:"http://localhost/course/findMyclass/"+response.data.id
        }).then(response => {
          _this.Course=response.data
        })
      })
    },
  },
  mounted() {
    this.username=this.$route.query.username
    this.action()
  },
  data() {
    return {
      Course:[],
      username:'',
      sid:'',
    }
  },
}
</script>

<style scoped>
.myClass{
  position: absolute;
  left: 150px;
  width: 89.9%;
  height: 800px;
  overflow-y: auto;

}
.course{
  margin-left: 300px;
  width: 400px;
  height: 150px;
  border-style:solid;
  border-width:1px;
  border-color: black;
  background-color: aquamarine;
  margin-top: 5px;
}
.courseID{
  padding-left: 5px;
  left: 30px;

}
.courseName{
  padding-left: 5px;
  left: 30px;
  padding-top: 10px;
}
.time{
  padding-left: 5px;
  left: 30px;
  padding-top: 10px;

}
</style>
